0e33619befaf801e0dc5d3bffcc51df40b8472ac,src/org/jgroups/util/PropertiesToXML.java,PropertiesToXML,classToXML,#Class#,81

Before Change


            TransformerFactory tf=TransformerFactory.newInstance();
            Transformer serializer=tf.newTransformer();
            serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
            serializer.setOutputProperty(OutputKeys.INDENT, "yes");
            serializer.transform(domSource, streamResult);
        }
    }

After Change


        boolean isConcreteClass=(clazz.getModifiers() & Modifier.ABSTRACT) == 0;
        boolean isExperimental=clazz.isAnnotationPresent(Experimental.class);
        boolean isUnsupported=clazz.isAnnotationPresent(Unsupported.class);
        if(isConcreteClass && !isExperimental && !isUnsupported) {
            Class<?> protocol=clazz;
            Document xmldoc=null;
            DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
            DocumentBuilder builder=factory.newDocumentBuilder();
            DOMImplementation impl=builder.getDOMImplementation();
            xmldoc=impl.createDocument(null, "table", null);
            Element row=createXMLTree(xmldoc);
            int propertyCount = 0;

            for(;clazz != null;clazz=clazz.getSuperclass()) {
                Field[] fields=clazz.getDeclaredFields();
                for(Field field:fields) {
                    if(field.isAnnotationPresent(Property.class)) {
                        String property=field.getName();
                        Element entry=xmldoc.createElement("entry");
                        entry.setTextContent(property);
                        row.appendChild(entry);

                        Property annotation=field.getAnnotation(Property.class);
                        String desc=annotation.description();
                        entry=xmldoc.createElement("entry");
                        entry.setTextContent(desc);
                        row.appendChild(entry);
                        propertyCount++;

                        //System.out.println(protocol + "#" + property + "=" + desc);
                    }
                }
            }
            //do we have more than one property (superclass Protocol has only one property (stats))
            if(propertyCount > 1) {
                DOMSource domSource=new DOMSource(xmldoc);
                StreamResult streamResult=new StreamResult(new File(protocol.getSimpleName() + ".xml"));
                TransformerFactory tf=TransformerFactory.newInstance();
                Transformer serializer=tf.newTransformer();
                serializer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
                serializer.setOutputProperty(OutputKeys.INDENT, "yes");
                serializer.transform(domSource, streamResult);
            }
        }